/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * WarrningDialog.java
 *
 * Created on 23.09.2010, 09:58:19
 */

package customComponents;

import org.jdesktop.application.Action;

import swimraceorganizer.SwimRaceOrganizerApp;

/**
 *
 * @author rsovarsz
 */
public class WarrningDialog extends javax.swing.JDialog {

    /** Creates new form EmptyFieldWarrningDialog */
    public WarrningDialog(java.awt.Frame parent) {
        super(parent);
        initComponents();
        getRootPane().setDefaultButton(jBOk);
    }

    public void setMessageField(String message) {
    	jLField.setText(message);    	
    }
    
    @Action public void closeWarrningDialog() {
        dispose(); 
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jBOk = new javax.swing.JButton();
        jLWarningMessage = new javax.swing.JLabel();
        jLField = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(swimraceorganizer.SwimRaceOrganizerApp.class).getContext().getResourceMap(WarrningDialog.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N
        setResizable(false);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(swimraceorganizer.SwimRaceOrganizerApp.class).getContext().getActionMap(WarrningDialog.class, this);
        jBOk.setAction(actionMap.get("closeWarrningDialog")); // NOI18N
        jBOk.setText(resourceMap.getString("jBOk.text")); // NOI18N
        jBOk.setName("jBOk"); // NOI18N

        jLWarningMessage.setText(resourceMap.getString("jLWarningMessage.text")); // NOI18N
        jLWarningMessage.setName("jLWarningMessage"); // NOI18N

        jLField.setText(resourceMap.getString("jLField.text")); // NOI18N
        jLField.setName("jLField"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(82, 82, 82)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLWarningMessage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLField)
                    .addComponent(jBOk))
                .addGap(93, 93, 93))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLWarningMessage)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLField)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jBOk)
                .addContainerGap(13, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                WarrningDialog dialog = new WarrningDialog(new javax.swing.JFrame());
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBOk;
    private javax.swing.JLabel jLField;
    private javax.swing.JLabel jLWarningMessage;
    // End of variables declaration//GEN-END:variables

}
